﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using CSharpDesign.DAL;
using CSharpDesign.BLL;

namespace CSharpDesign.Admin
{
    public partial class EditOrder : System.Web.UI.Page
    {
        EditOrderService orderService = new EditOrderService();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                gvbind();
            }
        }
        protected void lbtnBack_Click(object sender, EventArgs e)
        {
            Response.Redirect("OrderManage.aspx");
        }
        protected void gvPOInfo_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            gvPOInfo.PageIndex = e.NewPageIndex;
            gvbind();
        }
        public void gvbind()
        {
            try
            {
                string orderId = Request["OrderID"].ToString();
                DataRowView mydrv = orderService.getMyDrv(orderId);
                txtONum.Text = Convert.ToString(mydrv.Row["TNum"]);
                txtOTPrice.Text = Convert.ToString(mydrv.Row["TPrice"]);

                DataRowView mydrvbind = orderService.GetMDrvBind(gvPOInfo, orderId);
                txtOMember.Text = Convert.ToString(mydrvbind.Row["OrderMember"]);

                DataRowView mydrvminfo = orderService.GetMyDrvminfo(orderId, txtOMember.Text.Trim());
                txtOMCity.Text = Convert.ToString(mydrvminfo.Row["Address"]);
                txtPhone.Text = Convert.ToString(mydrvminfo.Row["SP"]);

            }
            catch
            {
                Response.Write("<script>alert('该用户已经不存在')<script>");
            }
        }

        
    }

}